import request from "@/utils/request";

// 注册用户管理列表
export function getRegisteredUserList(query) {
    return request({
        url: "/system/role/list",
        method: "get",
        params: query,
    });
}

// 查询用户账单明细
export function getUserBillingDetailList(roleId) {
    return request({
        url: "/system/role/" + roleId,
        method: "get",
    });
}

// 新增角色
export function addRole(data) {
    return request({
        url: "/system/role",
        method: "post",
        data: data,
    });
}

// 修改角色
export function updateRole(data) {
    return request({
        url: "/system/role",
        method: "put",
        data: data,
    });
}

// 角色数据权限
export function dataScope(data) {
    return request({
        url: "/system/role/dataScope",
        method: "put",
        data: data,
    });
}

// 角色状态修改
export function changeRoleStatus(roleId, status) {
    const data = {
        roleId,
        status,
    };
    return request({
        url: "/system/role/changeStatus",
        method: "put",
        data: data,
    });
}

// 删除角色
export function delRole(roleId) {
    return request({
        url: "/system/role/" + roleId,
        method: "delete",
    });
}

// 查询角色已授权用户列表
export function allocatedUserList(query) {
    return request({
        url: "/system/role/authUser/allocatedList",
        method: "get",
        params: query,
    });
}

// 查询角色未授权用户列表
export function unallocatedUserList(query) {
    return request({
        url: "/system/role/authUser/unallocatedList",
        method: "get",
        params: query,
    });
}

// 取消用户授权角色
export function authUserCancel(data) {
    return request({
        url: "/system/role/authUser/cancel",
        method: "put",
        data: data,
    });
}

// 批量取消用户授权角色
export function authUserCancelAll(data) {
    return request({
        url: "/system/role/authUser/cancelAll",
        method: "put",
        params: data,
    });
}

// 授权用户选择
export function authUserSelectAll(data) {
    return request({
        url: "/system/role/authUser/selectAll",
        method: "put",
        params: data,
    });
}

// 根据角色ID查询部门树结构
export function deptTreeSelect(roleId) {
    return request({
        url: "/system/role/deptTree/" + roleId,
        method: "get",
    });
}

export const getMemberList = (query) => {
    return request({
        url: "/system/member/list",
        method: "get",
        params: query,
    });
};

// 会员权益列表
export const getRightConfigListAPI = (query) => {
    return request({
        url: "/system/rai/list",
        method: "get",
        params: query,
    });
};

// 新增会员权益
export function addRightConfigAPI(data) {
    return request({
        url: "/system/rai",
        method: "post",
        data: data,
    });
}

// 修改会员权益
export function updateRightConfigAPI(data) {
    return request({
        url: "/system/rai",
        method: "put",
        data: data,
    });
}

export const getMemberDetailsList = (query) => {
    return request({
        url: "/system/details/list",
        method: "get",
        params: query,
    });
};

// 会员套餐配置
export const getSysComboMealListAPI = (query) => {
    return request({
        url: "/system/meal/list",
        method: "get",
        params: query,
    });
};
// 新增会员套餐配置
export function addSysComboMealAPI(data) {
    return request({
        url: "/system/meal",
        method: "post",
        data: data,
    });
}
export function updateSysComboMealAPI(data) {
    return request({
        url: "/system/meal",
        method: "put",
        data: data,
    });
}


// 门店库存列表
export const getStoreStockListAPI = (query) => {
    return request({
        url: "/system/storeStock/list",
        method: "get",
        params: query,
    });
};

// 新增门店库存
export function addStoreStockAPI(data) {
    return request({
        url: "/system/storeStock",
        method: "post",
        data: data,
    });
}

// 修改门店库存
export function updateStoreStockAPI(data) {
    return request({
        url: "/system/storeStock",
        method: "put",
        data: data,
    });
}
// 删除门店库存
export function delStoreStock(id) {
    return request({
        url: "/system/storeStock/" + id,
        method: "delete",
    });
}

// 查询会员套餐订单列表
export const getSetMenuListAPI = (query) => {
    return request({
        url: "/system/setMenu/list",
        method: "get",
        params: query,
    });
};

// 查询会员权益订单列表
export const getOrderListAPI = (query) => {
    return request({
        url: "/system/order/list",
        method: "get",
        params: query,
    });
};

export function getStockDetails(Id) {
    return request({
        url: "/system/stockDetails/" + Id,
        method: "get",
    });
}

export const getStoreOpenAPI = (query) => {
    return request({
        url: "/system/storeOpen/list",
        method: "get",
        params: query,
    });
};

export function addStoreOpenAPI(data) {
    return request({
        url: "/system/storeOpen",
        method: "post",
        data: data,
    });
}
export function addMember(data) {
    return request({
        url: "/system/member/addMember",
        method: "post",
        data: data,
    });
}

export function updateStoreOpenAPI(data) {
    return request({
        url: "/system/storeOpen",
        method: "put",
        data: data,
    });
}

export function delStoreOpen(id) {
    return request({
        url: "/system/storeOpen/" + id,
        method: "delete",
    });
}

export function addExpressAPI(data) {
    return request({
        url: "/system/express",
        method: "post",
        data: data,
    });
}

export const getAddressAPI = (id) => {
    return request({
        url: "/system/address/" + id,
        method: "get",
    });
};

export const getGoodsRaiListAPI = (query) => {
    return request({
        url: "/system/goods/raiList",
        method: "get",
        params: query,
    });
};

export const getStockDetailsAPI = (query) => {
    return request({
        url: "system/stockDetails/list",
        method: "get",
        params: query,
    });
};

export const getSetMenuGetRaiNumAPI = (query) => {
    return request({
        url: "system/setMenu/getRaiNum",
        method: "get",
        params: query,
    });
};

export const systemStockList = (query) => {
    return request({
        url: "system/stock/list",
        method: "get",
        params: query,
    });
};
export const systemStockListId = (query) => {
    return request({
        url: "/system/stock/listById",
        method: "get",
        params: query,
    });
};